Comparing Approaches to Generic Programming in Haskell

Comparing Approaches to Generic Programming in Haskell by Ralf Hinze, Johan Jeuring, and Andres Löh. 2006.
You just started implementing your third web shop in Haskell, and you realize that a lot of the code you have to write is similar to the code for the previous web shops. Only the data types have changed. Unfortunately, this implies that all reporting, editing, storing and loading in the database functionality, and probably a lot more, has to be changed. You’ve heard about generic programming, a technique which can be used to automatically generate programs depending on types. But searching on the web gives you almost ten approaches to solve your problem: DrIFT, PolyP, Generic Haskell, Derivable Type Classes, Template Haskell, Scrap Your Boilerplate, Generics for the Masses, Strafunski, etc. How do you choose? And these are only the approaches to generic programming in Haskell. If you are also flexible in the programming language you use, there is a much larger variety of different approaches to generic programming to choose from.
[on edit: updated link to point to a more complete version of the paper]

Misc items

A couple of items I came across, that might be of some interest.

Extending Prolog with Incomplete Fuzzy Information

Extending Prolog with Incomplete Fuzzy Information. Susana Munoz-Hernandez, Claudio Vaucheret. 2005.

Our first work (Fuzzy Prolog) was a language that models $\mathcal{B}([0,1])$-valued Fuzzy Logic. In the Borel algebra, $\mathcal{B}([0,1])$, truth value is represented using unions of intervals of real numbers. This work was more general in truth value representation and propagation than previous works.
An interpreter for this language using Constraint Logic Programming over Real numbers (CLP(${\cal R}$)) was implemented and is available in the Ciao system. Now, we enhance our former approach by using default knowledge to represent incomplete information in Logic Programming. We also provide the implementation of this new framework. This new release of Fuzzy Prolog handles incomplete information, it has a complete semantics (the previous one was incomplete as Prolog) and moreover it is able to combine crisp and fuzzy logic in Prolog programs.

A project of related interest is Fril which as far as I remember wasn't discussed here.

Bit Stream Programing in Erlang

Since 2001, the functional language Erlang comes with a byte-oriented datatype (called binary) and with constructs to do pattern matching on a binary. We have been heavily involved in this work and implemented a scheme for native code compilation of binaries and designed efficient algorithms for constructing deterministic pattern matching automata for byte-based binaries. In last year's Erlang workshop we put forward a proposal for lifting the restriction that Erlang binaries are sequences of bytes rather than bits and described the semantics of bit-level pattern matching on a bit-level binary (called bit stream). We have subsequently realized this proposal and describe its applications and implementation in this paper.
Be sure to see the benchmarks on page 13 comparing Erlang, Haskell, Objective Caml, C, and Java for processing binary data. Having used the existing binary pattern matching support in Erlang, I'm looking forward to the official language support for bit streams.

The Role of Composition in Computer Programming

This paper by Donald McIntyre is a classic in the J language world. It ranks up there with "Why Functional Programming Matters" in terms of concise, impressive examples. Most of the examples have a geometric bent, like finding the area of a polygon. Note that this paper was written using an early version of J, so some of the syntax has unfortunately changed.

Teaching Discrete Mathematics via Primary Historical Sources

(via LogBlog)

This site offers written curricular materials, based on primary historical sources, for beginning and advanced undergraduate courses in discrete mathematics and computer science. Such courses, which often cover combinatorics, deductive reasoning (logic) and algorithmic thought, draw a variety of majors, ranging from computer science, mathematics, the physical sciences and engineering to secondary education. Traditional methods of instruction follow ``The Modern American Discrete Mathematics Text,'' which although thorough and mathematically precise, present the material as a fast-paced news reel of facts and formulae, often memorized by the students, with the text itself offering only passing mention of the motivating problems and original work which eventually found resolution in modern concepts such as induction, recursion, or algorithm.

This sort of apporach is very close to my heart, as LtU readers probably know. I wish them well.

Elements of Interaction

Robin Milner's 1991 Turing Award Lecture describing CCS (Calculus for Communicating Systems) and pi-calculus.

An Axiomatic Basis for Computer Programming

An Axiomatic Basis for Computer Programming by Tony Hoare, 1969.

In this paper an attempt is made to explore the logical foundations of computer programming by use of techniques which were first applied in the study of geometry and have later been extended to other branches of mathematics. This involves the elucidation of sets of axioms and rules of inference which can be used in proofs of the properties of computer programs. Examples are given of such axioms and rules, and a formal proof of a simple theorem is displayed. Finally, it is argued that important advantage, both theoretical and practical, may follow from a pursuance of these topics.

Considered by many to be among the best of the great works in programming languages.

Practical Type Inference Based on Success Typings

We show that it is possible to reconstruct a significant portion of the type information which is implicit in a program, automatically annotate function interfaces, and detect definite type clashes without fundamental changes to the philosophy of the language or imposing a type system which unnecessarily rejects perfectly reasonable programs. To do so, we introduce the notion of success typings of functions. Unlike most static type systems, success typings incorporate subtyping and never disallow a use of a function that will not result in a type clash during runtime. Unlike most soft typing systems that have previously been proposed, success typings allow for compositional, bottom-up type inference which appears to scale well in practice.
A recent paper using a subset of Erlang for the examples. This continues the trend of methods for uncovering type errors in dynamically-typed Erlang. One such tool, Dialyzer, is now part of the Erlang distribution.

Java Open Review Project

The Java Open Review Project identifies and reports bugs and security vulnerabilities in widely used Java open source software...The identification process is powered by Fortify Source Code Analysis (SCA) and Findbugs.

This may be an easy way to get a glimpse at what static analysis tools can do. Reviewing the potential defects identified by the automatic tools is a good starting point for thinking about the implications of various decisions about language semantics, and about language expressiveness in general.

To see actual code, you need to login using the guest account details provided on the page.